﻿using System.Configuration.Provider;
using NCMIS.ObjectModel;
using NCMIS.Produce;

namespace NCMIS.Provider
{
    /// <summary>
    /// Provides the base implementation for the Navigation Provider for the Navigation Services. The navigation services
    /// are used to traverse the folder hierarchy in a CMIS Repository, and to locate Documents that are checked out.
    /// </summary>
    public abstract class NavigationProviderBase : ProviderBase
    {
        /// <summary>
        /// When implemented in a derived class, gets the list of child objects contained in the specified folder.
        /// </summary>
        /// <param name="repositoryId">The id of the repository.</param>
        /// <param name="folderId">The folder id of the folder to retreive descendants for.</param>
        /// <param name="maxItems">The maximum number of items to return in the response. (Optional)</param>
        /// <param name="skipCount">The number of potential results to skip before returning any results.</param>
        /// <param name="orderBy">Specifies sort specification for returned result, must be a comma separated list of one or more column names.</param>
        /// <param name="filter">Value indicating which properties for Objects that must be returned.</param>
        /// <param name="includeRelationships">Value indicating what relationships in which the objects returned participate that must be returned, if any.</param>
        /// <param name="renditionFilter">Renditions whose kind matches this filter must be returned.</param>
        /// <param name="includeAllowableActions">If true, then the the available actions for each object in the result set must be returned.</param>
        /// <param name="includePathSegment">If true, then a PathSegment for each child object, for use in constructing that object’s path, must be returned.</param>
        /// <returns>Child objects for specified folder.</returns>
        public abstract PathedCmisObjectList GetChildren(string repositoryId, string folderId, int? maxItems, int skipCount, string orderBy, string filter,
            IncludeRelationships includeRelationships, string renditionFilter, bool includeAllowableActions, bool includePathSegment);

        /// <summary>
        /// Gets the set of descendant objects contained in the specified folder or any of its child-folders.
        /// </summary>
        /// <param name="repositoryId">The id of the repository.</param>
        /// <param name="folderId">The folder id of the folder to retreive descendants for.</param>
        /// <param name="depth">The number of levels of depth in the type hierachy from which to return results. (Optional)</param>
        /// <param name="filter">Value indicating which properties for Objects that must be returned.</param>
        /// <param name="includeRelationships">Value indicating what relationships in which the objects returned participate that must be returned, if any.</param>
        /// <param name="renditionFilter">Renditions whose kind matches this filter must be returned.</param>
        /// <param name="includeAllowableActions">If true, then the the available actions for each object in the result set must be returned.</param>
        /// <param name="includePathSegment">If true, then a PathSegment for each child object, for use in constructing that object’s path, must be returned.</param>
        /// <returns>Descendant objects for specified folder.</returns>
        public abstract PathedCmisObjectContainer[] GetDescendants(string repositoryId, string folderId, int? depth, string filter, IncludeRelationships includeRelationships,
            string renditionFilter, bool includeAllowableActions, bool includePathSegment);

        /// <summary>
        /// Gets the set of descendant folder objects contained in the specified folder. A hierarchical feed comprising all the folders under a specified folder.
        /// </summary>
        /// <param name="repositoryId">The id of the repository.</param>
        /// <param name="folderId">The folder id of the folder to retreive tree for.</param>
        /// <param name="depth">The number of levels of depth in the type hierachy from which to return results. (Optional)</param>
        /// <param name="filter">Value indicating which properties for Objects that must be returned.</param>
        /// <param name="includeRelationships">Value indicating what relationships in which the objects returned participate that must be returned, if any.</param>
        /// <param name="renditionFilter">Renditions whose kind matches this filter must be returned.</param>
        /// <param name="includeAllowableActions">If true, then the the available actions for each object in the result set must be returned.</param>
        /// <param name="includePathSegment">If true, then a PathSegment for each child object, for use in constructing that object’s path, must be returned.</param>
        /// <returns>Descendant folder objects, for the specified folder.</returns>
        public abstract PathedCmisObjectContainer[] GetFolderTree(string repositoryId, string folderId, int? depth, string filter, IncludeRelationships includeRelationships,
            string renditionFilter, bool includeAllowableActions, bool includePathSegment);

        /// <summary>
        /// Gets the parent folder object for the specified folder object.
        /// </summary>
        /// <param name="repositoryId">The id of the repository.</param>
        /// <param name="folderId">The folder id to retreive parent folder object for.</param>
        /// <param name="filter">Value indicating which properties for Objects that must be returned.</param>
        /// <returns>Parent folder object for specified folder.</returns>
        public abstract CmisObject GetFolderParent(string repositoryId, string folderId, string filter);

        public abstract PathedCmisObject[] GetObjectParents(string repositoryId, string objectId, string filter, IncludeRelationships includeRelationships,
            string renditionFilter, bool includeAllowableActions, bool includeRelativePathSegment);

        /// <summary>
        /// Gets the checked out documents. 
        /// </summary>
        /// <param name="repositoryId">The id of the repository.</param>
        /// <param name="folderId">The folder id of the folder to retreive checkedout documents for. If left out all checked out documents will be returned.</param>
        /// <param name="filter">Value indicating which properties for Objects that must be returned.</param>
        /// <param name="orderBy">Specifies sort specification for returned result, must be a comma separated list of one or more column names.</param>
        /// <param name="includeAllowableActions">If true, then the the available actions for each object in the result set must be returned.</param>
        /// <param name="includeRelationships">Value indicating what relationships in which the objects returned participate that must be returned, if any.</param>
        /// <param name="renditionFilter">Renditions whose kind matches this filter must be returned.</param>
        /// <param name="maxItems">The maximum number of items to return in the response. (optional)</param>
        /// <param name="skipCount">The number of potential results to skip before returning any results.</param>
        /// <returns>Checked out documents.</returns>
        public abstract CmisObjectList GetCheckedoutDocs(string repositoryId, string folderId, string filter, string orderBy, bool includeAllowableActions,
            IncludeRelationships includeRelationships, string renditionFilter, int? maxItems, int skipCount);
    }
}
